package com.megvii.corelib.util;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

/**
 * Created by linyue on 16/3/3.
 * 短信
 */
public class SMessageUtil
{
    /**
     * 返回false代表系统没有发送短信的功能
     * @param context
     * @param text
     * @return
     */
    public static boolean sendMessage(Context context, String text)
    {
        Uri smsToUri = Uri.parse("smsto:");
        Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
        intent.putExtra("sms_body", text);
        try
        {
            context.startActivity(intent);
        }
        catch (ActivityNotFoundException e)
        {
            return false;
        }
        return true;
    }
}
